﻿@*
This is a shape template. It looks just like an ordinary view template, but the Model object is the shape we've created with New.PersonListDashboard()
in ContentsAdminController. Therefore it also has the dynamic properties we filled up in the controller, so we'll also use them.

Be warned, this won't look too nice from the browser, but probably we can live with it for now :-).

To make itt a little nicer, you may want to apply additional stylesheets to your templates or to implement some client-side logic you'll need JS/jQuery.
Orchard gives you the ability to render (yes, render is the correct word) stylesheets and scripts in a given template. The are "rendered", because they
are shapes (it wasn't always like that) and thus it is possible to override them! Pretty thoughtful, right?
Now it turns out that we lied and we're going to have a call stack deeper than one sublevel. You'll do fine.

Please check out ResourceManifest.cs in the root to see how can you declare resources and come back here to see how to use them!
*@

@*
We'll "Require" (because that's what we do with local resources) the "Other" stylesheet and place it in the Head section. You can place resources to the
Footer using AtFoot(). The resource named "OrchardHUN.TrainingDemo.Dependecy" will also be embedded, since "Other" depends on it.
After that, we'll "Include" (because that's what we do with remote resources) the jQuery from it's official CDN and place it in the Footer.
Since Orchard is shipped with jQuery included (in the Orchard.jQuery module), the correct way to use jQuery would be: Script.Require("jQuery").AtHead();
*@
@{
    Style.Require("OrchardHUN.TrainingDemo.Other");
    Script.Include("http://code.jquery.com/jquery-1.8.3.min.js").AtFoot();
}

@*TitleForPage also adds the title to the title tag*@
<h1>@Html.TitleForPage(T("Person List dashboard").ToString())</h1>


@* When the id is 0 we display the editor for a new item *@
@Html.Link(T("Create new Person List").Text, Url.Action("PersonListDashboard", new { Id = 0 }))
@* Note that we constructed the URL for the link dynamically. Never wire in URLs directly! See the other Url.X() helpers too! *@

@*
Displaying an ad-hoc shape. As you can see we can create shapes here as well through the New property. We can also pass it arguments just as we
did from the controller. This shape will be rendered by the Views/ComplimentaryEncouragement template but having a template with the same name
in our theme we can override it (also see: http://docs.orchardproject.net/Documentation/Alternates).

When developing an Orchard module it's good practice to divide the ouput into shapes each containing some logically coherent part. This way the
templates of those parts can be individually overridden from the theme, giving fine-grained control over the resulting markup.

That's a bit similar to the standard MVC RenderPartial().

Also notice that we use the WorkContext object here again. Feel free to look into the objects available in views!
*@
<h2>@T("Complimentary encouragement")</h2>
@Display(New.ComplimentaryEncouragement(Name: WorkContext.CurrentUser.UserName))


<h2>@T("Edit Person List")</h2>
@Html.ValidationSummary(T("The Person List could not be edited. Please correct the errrors below.").ToString())

@* The editor shape only contains the inside of the form, so we have to wrap it into a form. The method we use here builds a XSS-protected form. *@
@using (Html.BeginFormAntiForgeryPost())
{
    @Display(Model.EditorShape())
}

@*NEXT STATION: Go back to Controllers/ContentsAdminController!*@